package org.frog.sgs.mina.client;

import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * @author duanxiangqi
 * @date 2012-10-18
 */
public class Client {

	public static void main(String[] args) throws Exception {
		Socket client = new Socket();
		client.connect(new InetSocketAddress("127.0.0.1", 14151));
		OutputStream os = client.getOutputStream();
		os.write(int2byte(349173829));
		os.close();
	}

	public static byte[] int2byte(int num) {
		byte[] bs = new byte[4];
		for (int i = 0; i < bs.length; i++) {
			bs[3 - i] = (byte) (num >>> (8 * i));
		}
		return bs;
	}
}
